from pandas import DataFrame, Series, date_range,to_datetime
from akshare import stock_zh_a_hist,stock_individual_fund_flow

def GetHistoryData(symbol:str,adjust:str)->DataFrame:
    hist = stock_zh_a_hist(symbol=symbol,adjust=adjust)
    hist.rename(columns={'日期':'date','股票代码':'symbol','开盘':'open','收盘':'close','最高':'high','最低':'low','成交量':'volume','成交额':'amount','振幅':'amplitude','涨跌幅':'changepercent','涨跌额':'change','换手率':'turnoverratio'},inplace=True)
    hist.date = to_datetime(hist.date)
    hist.set_index('date',drop=True,inplace=True)
    return hist

def stock_fund_flow(symbol:str)->DataFrame:
    fund_flow_df = stock_individual_fund_flow(stock=symbol)
    
    return fund_flow_df